|
OpenStack Ocata : How to use Manila#2
2017/03/05 |
|
This is How to use OpenStack Shared File System (Manila).
This example is based on the emvironment like follows.
For example, Configure Manila share to use a designed instance.
It needs to use Cinder storage for backends, so Configure Cinder and create a block storage first.
------------+--------------------------------+--------------------------------+------------
| | |
eth0|10.0.0.30 eth0|10.0.0.50 eth0|10.0.0.51
+-----------+-----------+ +-----------+-----------+ +-----------+-----------+
| [ Control Node ] | | [ Storage Node ] | | [ Compute Node ] |
| | | | | |
| MariaDB RabbitMQ | | Open vSwitch | | Libvirt |
| Memcached httpd | | L2,L3,Metadata Agent | | Nova Compute |
| Keystone Glance | | Cinder Volume | | Open vSwitch |
| Nova API Cinder API | | Manila Share | | L2 Agent |
| Neutron Server | | | | |
| Manila API | | | | |
+-----------------------+ +-----------------------+ +-----------------------+
|
| [1] | Configure Storage Node. |
|
[root@storage ~]#
vi /etc/manila/manila.conf # add follows into [DEFAULT] section
enabled_share_backends = generic
# addfollows to the end
[neutron]
url = http://10.0.0.30:9696
auth_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:35357
memcached_servers = 10.0.0.30:11211
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = servicepassword
[nova]
auth_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:35357
memcached_servers = 10.0.0.30:11211
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = nova
password = servicepassword
[cinder]
auth_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:35357
memcached_servers = 10.0.0.30:11211
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = cinder
password = servicepassword
[generic]
share_backend_name = backend01
share_driver = manila.share.drivers.generic.GenericShareDriver
driver_handles_share_servers = True
service_instance_flavor_id = 1
service_image_name = manila-service-image
service_instance_user = manila
service_instance_password = manila
interface_driver = manila.network.linux.interface.OVSInterfaceDriver
systemctl start openstack-manila-share [root@storage ~]# systemctl enable openstack-manila-share
|
| [2] | Download official Manila designed image and add it to Glance. |
|
[root@dlp ~(keystone)]# curl -O http://tarballs.openstack.org/manila-image-elements/images/manila-service-image-master.qcow2 [root@dlp ~(keystone)]# openstack image create "manila-service-image" --file manila-service-image-master.qcow2 --disk-format qcow2 --container-format bare --public +------------------+------------------------------------------------------+ | Field | Value | +------------------+------------------------------------------------------+ | checksum | f0dfd7af9cbb831ff116d0c0e387a610 | | container_format | bare | | created_at | 2017-03-05T11:28:48Z | | disk_format | qcow2 | | file | /v2/images/1b46666f-bb58-4bd0-a120-605650dc01fa/file | | id | 1b46666f-bb58-4bd0-a120-605650dc01fa | | min_disk | 0 | | min_ram | 0 | | name | manila-service-image | | owner | c654e2e098b14356b97b6e613775cc54 | | protected | False | | schema | /v2/schemas/image | | size | 348594176 | | status | active | | tags | | | updated_at | 2017-03-05T11:28:49Z | | virtual_size | None | | visibility | public | +------------------+------------------------------------------------------+ |
| [3] | Create default share type. |
|
[root@dlp ~(keystone)]# manila type-create default_share_type True +----------------------+--------------------------------------+ | Property | Value | +----------------------+--------------------------------------+ | required_extra_specs | driver_handles_share_servers : True | | Name | default_share_type | | Visibility | public | | is_default | - | | ID | 56f8f956-c249-4920-904c-6a66cb979a07 | | optional_extra_specs | | +----------------------+--------------------------------------+[root@dlp ~(keystone)]# manila type-list +-----------+--------------------+------------+------------+-------------------------------------+----------------------+ | ID | Name | visibility | is_default | required_extra_specs | optional_extra_specs | +-----------+--------------------+------------+------------+-------------------------------------+----------------------+ | 56f8f956- | default_share_type | public | YES | driver_handles_share_servers : True | | +-----------+--------------------+------------+------------+-------------------------------------+----------------------+ |
| [4] | Create shared network. |
|
[root@dlp ~(keystone)]# openstack network list +--------------------------------------+---------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+---------+--------------------------------------+ | 0caa61ce-db39-44dc-9c54-a50bb48fae08 | ext_net | a3cc573a-8066-49a1-bf0e-21ed53595452 | | e82354f3-7820-421f-b8d6-0b67ff26f5c2 | int_net | 4a0d9278-6b06-4809-9b35-e7facff737d2 | +--------------------------------------+---------+--------------------------------------+[root@dlp ~(keystone)]# openstack subnet list +--------------------------------------+---------+--------------------------------------+------------------+ | ID | Name | Network | Subnet | +--------------------------------------+---------+--------------------------------------+------------------+ | 4a0d9278-6b06-4809-9b35-e7facff737d2 | subnet1 | e82354f3-7820-421f-b8d6-0b67ff26f5c2 | 192.168.100.0/24 | | a3cc573a-8066-49a1-bf0e-21ed53595452 | subnet2 | 0caa61ce-db39-44dc-9c54-a50bb48fae08 | 10.0.0.0/24 | +--------------------------------------+---------+--------------------------------------+------------------+
[root@dlp ~(keystone)]#
[root@dlp ~(keystone)]# INT_NET=$(openstack network list | grep 'int_net' | awk '{print $2}') [root@dlp ~(keystone)]# INT_SUBNET=$(openstack subnet list | grep 'subnet1' | awk '{print $2}')
manila share-network-create --neutron-net-id $INT_NET --neutron-subnet-id $INT_SUBNET --name manila_share +-------------------+--------------------------------------+ | Property | Value | +-------------------+--------------------------------------+ | network_type | None | | name | manila_share | | segmentation_id | None | | created_at | 2017-03-05T11:37:50.098835 | | neutron_subnet_id | 4a0d9278-6b06-4809-9b35-e7facff737d2 | | updated_at | None | | mtu | None | | gateway | None | | neutron_net_id | e82354f3-7820-421f-b8d6-0b67ff26f5c2 | | ip_version | None | | cidr | None | | project_id | c654e2e098b14356b97b6e613775cc54 | | id | 7227b417-8f63-4b78-9c17-7c691ac92312 | | description | None | +-------------------+--------------------------------------+[root@dlp ~(keystone)]# manila share-network-list +--------------------------------------+--------------+ | id | name | +--------------------------------------+--------------+ | 7227b417-8f63-4b78-9c17-7c691ac92312 | manila_share | +--------------------------------------+--------------+ |
| [5] | Create NFS share. |
|
# create flavor id 1 [root@dlp ~(keystone)]# openstack flavor create --id 1 --vcpus 1 --ram 2048 --disk 10 m1.tiny +----------------------------+----------+ | Field | Value | +----------------------------+----------+ | OS-FLV-DISABLED:disabled | False | | OS-FLV-EXT-DATA:ephemeral | 0 | | disk | 10 | | id | 0 | | name | m1.small | | os-flavor-access:is_public | True | | properties | | | ram | 2048 | | rxtx_factor | 1.0 | | swap | | | vcpus | 1 | +----------------------------+----------+[root@dlp ~(keystone)]# manila create NFS 1 --name share01 --share-network manila_share
+---------------------------------------+--------------------------------------+
| Property | Value |
+---------------------------------------+--------------------------------------+
| status | creating |
| share_type_name | default_share_type |
| description | None |
| availability_zone | None |
| share_network_id | b7929ba2-127d-4226-89fa-cdbbb055d69c |
| share_server_id | None |
| share_group_id | None |
| host | |
| revert_to_snapshot_support | False |
| access_rules_status | active |
| snapshot_id | None |
| create_share_from_snapshot_support | False |
| is_public | False |
| task_state | None |
| snapshot_support | False |
| id | 5f07034e-83de-4702-b62d-e8bd31c06ff8 |
| size | 1 |
| source_share_group_snapshot_member_id | None |
| user_id | cf3c5cbcdd214707b91d322a69af038e |
| name | share01 |
| share_type | b30ba44b-3716-4589-829b-bf9f92e40e9b |
| has_replicas | False |
| replication_type | None |
| created_at | 2017-03-05T12:58:36.000000 |
| share_proto | NFS |
| mount_snapshot_support | False |
| project_id | c654e2e098b14356b97b6e613775cc54 |
| metadata | {} |
+---------------------------------------+--------------------------------------+
# few minutes later, the Status turns to available [root@dlp ~(keystone)]# manila list +-----------+---------+------+-------------+-----------+-----------+--------------------+------------------+-------------------+ | ID | Name | Size | Share Proto | Status | Is Public | Share Type Name | Host | Availability Zone | +-----------+---------+------+-------------+-----------+-----------+--------------------+------------------+-------------------+ | 857b6ef2- | share01 | 5 | NFS | available | False | default_share_type | network.srv.w... | nova | +-----------+---------+------+-------------+-----------+-----------+--------------------+------------------+-------------------+ |
| [6] | At this point, 10.254.0.0/16(default network in manila.conf) network has been created on Storage Node. |
|
[root@storage ~]# ip addr
.....
.....
17: tap6f40c109-dc: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN qlen 1000
link/ether fa:16:3e:d8:ad:95 brd ff:ff:ff:ff:ff:ff
inet 10.254.0.5/28 brd 10.254.0.15 scope global tap6f40c109-dc
valid_lft forever preferred_lft forever
inet6 fe80::f816:3eff:fed8:ad95/64 scope link
valid_lft forever preferred_lft forever
.....
.....
|
| [7] | It's OK all, you can use Manila Shared filesystem from Instances like follows. |
|
[root@dlp ~(keystone)]# openstack server list +----------------+----------+---------+-----------------------------------+------------+ | ID | Name | Status | Networks | Image Name | +----------------+----------+---------+-----------------------------------+------------+ | b17e0565-3abe- | CentOS_7 | SHUTOFF | int_net=192.168.100.5, 10.0.0.201 | CentOS7 | +----------------+----------+---------+-----------------------------------+------------+ # allow access rights first [root@dlp ~(keystone)]# manila access-allow share01 ip 10.0.0.0/24 --access-level rw +--------------+--------------------------------------+ | Property | Value | +--------------+--------------------------------------+ | access_key | None | | share_id | 857b6ef2-6ddf-4a03-9177-35abd35ce205 | | access_type | ip | | access_to | 10.0.0.0/24 | | access_level | rw | | state | queued_to_apply | | id | c8a9c652-009b-48a9-9283-a5f3c5def713 | +--------------+--------------------------------------+ # it's no ploblem if State turns to active [root@dlp ~(keystone)]# manila access-list share01 +--------------------------------------+-------------+------------------+--------------+--------+------------+ | id | access_type | access_to | access_level | state | access_key | +--------------------------------------+-------------+------------------+--------------+--------+------------+ | c8a9c652-009b-48a9-9283-a5f3c5def713 | ip | 10.0.0.0/24 | rw | active | None | +--------------------------------------+-------------+------------------+--------------+--------+------------+
[root@dlp ~(keystone)]#
openstack server start CentOS_7 # confirm access Path [root@dlp ~(keystone)]# manila show share01 | grep path | cut -d'|' -f3 path = 10.254.0.7:/shares/share-35353aa3-389c-4274-a28a-14563b28fc2a
[root@dlp ~(keystone)]#
ssh 10.0.0.201 root@10.0.0.201's password: Last login: Sun Mar 5 20:05:49 2017 from dlp.srv.world # mount Manila shared storage [root@host-192-168-100-5 ~]# mount -t nfs 10.254.0.7:/shares/share-35353aa3-389c-4274-a28a-14563b28fc2a /mnt [root@host-192-168-100-5 ~]# df -hT Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/cl-root xfs 8.0G 1015M 7.0G 13% / devtmpfs devtmpfs 990M 0 990M 0% /dev tmpfs tmpfs 1001M 0 1001M 0% /dev/shm tmpfs tmpfs 1001M 8.3M 993M 1% /run tmpfs tmpfs 1001M 0 1001M 0% /sys/fs/cgroup /dev/vda1 xfs 1014M 121M 894M 12% /boot tmpfs tmpfs 201M 0 201M 0% /run/user/0 10.254.0.7:/shares/share-35353aa3-389c-4274-a28a-14563b28fc2a nfs4 976M 1.3M 908M 1% /mnt |